function setOption(chart, title, pieData) {
  var option = {
    backgroundColor: "#ffffff",
    color: ["#37A2DA", "#32C5E9", "#67E0E3", "#91F2DE", "#FFDB5C", "#FF9F7F"],
    title: {
      text: title,
      left: 'center'
    },

    series: [{
      type: 'pie',
      radius: '50%',
      center: ['50%', '50%'],
      data: pieData.sort(function (a, b) { return a.value - b.value; }),
      animationType: 'scale',
      animationEasing: 'elasticOut',
      animationDelay: function (idx) {
        return Math.random() * 200;
      },
      label: {
        position: 'outer',
        alignTo: 'labelLine',
        bleedMargin: 5
      },
    }]
  };
  chart.setOption(option);
}

module.exports = {
  setOption: setOption
}
